import {
    getHeatPoint
} from "../DistrictCluster/function/createPoints"
let heatmap;
// ------------ 添加热力图 -----------------
export function addHeat(map, data_content) {
    var points = [{
            "lng": 116.191031,
            "lat": 39.988585,
            "count": 10
        },
        {
            "lng": 116.389275,
            "lat": 39.925818,
            "count": 11
        },
        {
            "lng": 116.287444,
            "lat": 39.810742,
            "count": 12
        },
        {
            "lng": 116.481707,
            "lat": 39.940089,
            "count": 13
        },
        {
            "lng": 116.410588,
            "lat": 39.880172,
            "count": 14
        },
        {
            "lng": 116.394816,
            "lat": 39.91181,
            "count": 15
        },
        {
            "lng": 116.416002,
            "lat": 39.952917,
            "count": 16
        }
    ];
    map.plugin(["AMap.Heatmap"], function () { //加载热力图插件

        heatmap = new AMap.Heatmap(
            map, {
                radius: 25, //给定半径
                opacity: [0, 0.8]
            }
        ); //在地图对象叠加热力图
        heatmap.setDataSet({
            data: getHeatPoint(data_content),
        }); //设置热力图数据集
        //具体参数见接口文档
    });
    // hiddenHeat();
}
// -------------- 隐藏热力图 ---------------
export function hiddenHeat(){
    heatmap.hide();
}
// -------------- 显示热力图 ----------------
export function showHeat(){
    heatmap.show();
}